<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Curriculo extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('curriculo_model');
        $this->load->library('table');
    }

    public function index() {
        $user_id = $this->session->userdata('id');

        $dados = array(
            //carrega views
            'header' => 'header.php',
            'divheader' => 'divheader.php',
            'divtopmenu' => 'divtopmenu.php',
            'divcontent' => 'meu_curriculo_v/curriculo_v.php',
            'divleftmenu' => 'divleftmenu.php',
            'divfooter' => 'divfooter.php',
            'form_academica' => $this->curriculo_model->get_form_academica($user_id)->result(),
            'exp_prof' => $this->curriculo_model->get_exp_prof($user_id)->result(),
            'perfil' => retornaperfil($this->session->userdata('user_role')),
            'menu_item' => criamenu($this->session->userdata('id'), $this->session->userdata('user_role')),
        );
        $this->load->view('main', $dados);
    }

    public function novo_cad_academico() {

        $this->form_validation->set_rules('nivel', 'NÍVEL DE FORMACÃO', 'required|alpha|max_lenght[254]|trim|ucwords');
        $this->form_validation->set_rules('instituicao', 'INSTITUIÇÃO', 'required|max_lenght[254]|trim');
        $this->form_validation->set_rules('curso', 'CURSO', 'required|max_lenght[254]|trim');
        $this->form_validation->set_rules('ano_conclusao', 'ANO DE CONCLUSÃO', 'required');

        if ($this->form_validation->run() == TRUE) {
            echo 'validacao ok';
        }

        $dados = array(
            //carrega views
            'header' => 'header.php',
            'divheader' => 'divheader.php',
            'divtopmenu' => 'divtopmenu.php',
            'divcontent' => 'meu_curriculo_v/formacao_academica_v.php',
            'divleftmenu' => 'divleftmenu.php',
            'divfooter' => 'divfooter.php',
            'perfil' => retornaperfil($this->session->userdata('user_role')),
            'menu_item' => criamenu($this->session->userdata('id'), $this->session->userdata('user_role')),
        );
        $this->load->view('main', $dados);
    }

}
